<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <ul id="wrapper"></ul>
    <script>
      const of = document.createDocumentFragment();
      const ulEl = document.querySelector("#wrapper");
      for (let i = 0; i < 10; i++) {
        const newLiEl = document.createElement("li");
        newLiEl.innerHTML = i;
        // ulEl.appendChild(newLiEl);
        // 直接使用str拼接比较节省性能
        of.appendChild(newLiEl);
      }
      ulEl.appendChild(of);
    </script>
  </body>
</html>
